
#include <iostream>
#include <sys/types.h>
#include <regex>
#include <string>

int main()
{
    std::string str = "GET /csdnmian_yang.blog/login?user=mian_yang&passwd=1111 HTTP/1.1";

    std::smatch matches;
    std::regex e("(GET|PUSH|DELE|HEAD|POST) ([^?]*)\\?([^ ]*) (HTTP/1\\.[01])(?:\r|\r\n)?");
    /*.能匹配任意字符, [^_]代表表示非_字符, \\?表示原始？字符， 然后(.*) 表示截取到空格为止*/
    bool ret = std::regex_match(str, matches, e); /*对字符串进行匹配，然后将指定信息提取放到matches中*/
    for (auto e : matches)
    {
        std::cout << e << std::endl;
    }

    return 0;
}